<html>
	<head>	
	</head>

	<?php
		$user = 'root';
		$server = 'localhost';

		$conexao = mysql_connect($server,$user,"");   
		mysql_select_db('extratime',$conexao);

	?>

	<body>
        <a href="enregistrer_client.php">Enregistrer un Client</a>
		<a href="enregistrer_restaurant.php">Enregistrer un Restaurant</a>
		<a href="enregistrer_user.php">Enregistrer Utilisateur</a>
        <a href="ajouter_file.php">Ajouter un Client </a>
		<a href="regarder_file.php">Regarder la file d'attente </a> 
		<fieldset>
			<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" name="enregistrer_user">
			<legend>Enregistrer un client</legend>
				<table>
					<tr>
						<td><label>Nom:  </label></td>
						<td><input type="text" size="50" name="user_nom"></td>
					</tr>
					<tr>
						<td><label>Prenom: </label></td>
						<td><input type="text" size="15" name="user_prenom"></td>
					</tr>					
					<tr>
						<td><label>Droit: </label></td>
						<td><input type="text" size="15" name="user_droit"></td>												
					</tr>
					<tr>
						<td><label>Mot de passe: </label></td>
						<td><input type="password" size="15" name="user_motpasse"></td>
					</tr>
					
				</table>
				<input type="hidden" name="verifica_envio" value="1" />
				<input type="submit" id="button"  name="enregistrer_user" value="Enregistrer" />		
			</form>
		</fieldset>        
      
		<?php
			if(array_key_exists("verifica_envio",$_POST)){
				$NOM=$_POST['user_nom'];
				$PRENOM=$_POST['user_prenom'];
				$DROIT=$_POST['user_droit'];
				$MOTPASSE=$_POST['user_motpasse'];
								    
				$insert="INSERT INTO user
					SET
						user_nom='$NOM',
						user_prenom='$PRENOM',
						user_droit='$DROIT',
						user_motpasse='$MOTPASSE'";
				if($resultado = mysql_query($insert,$conexao)) {
					echo "Sucess!\n";
				}
				else{
					echo "Erreur\n";					
				}
			}	
		?>
	</body>
</html>
